home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Meeting Pearls 1
/
Meeting Pearls Vol 1 (1994).iso
/
pastex
/
rexx
/
start_tex.ced
< prev
next >
Wrap
Text File
|
1991-07-27
|
3KB
|
126 lines
/*RX
* AREXX Name:Start_TeX.ced Version:1.41 Date:27-Jul-91
*
This AREXX script saves and compiles the current CED view. The only
(optional) argument is the format to be used. A '?' formatname will
interactively ask for the format to use.
*
A command is send to the TeX server to compile the file. Hence a
return value of 0 does not mean that the file compiled well, but only
that the command was sent to the server and replied to.
*
AUTHOR:
* J\"org H\"ohle, March 91
*
BUGS:
virtex doesn't like filenames with blanks (and ARexx parses them
hardly too), so avoid them in file, directory *and* device names.
*
Does not like names relative to the local root, like ":foo/bar"
*
FILES:
ENV:TEXFORMAT: default format used
REXX:namestruc
*
*/
/* OPTIONS FAILAT 3 */
/**
IF ~SHOW('L','rexxsupport.library') THEN
IF ~ADDLIB('rexxsupport.library',0,-30,0) THEN DO
okay1 "Can't open 'rexxsupport.library'!"
EXIT 20
END
**/
OPTIONS RESULTS
portname = 'Start_TeX'
script = 'TeX-server.rexx' /* no path required, message only */
IF "" = GETCLIP("TEXQUERY") THEN askformat = 0
ELSE askformat = 1 /* ask interactively for format name */
PARSE ARG format .
IF "?" = format THEN DO
askformat= 1
format = ""
END
ELSE IF '&' = LEFT(format,1) THEN
format = SUBSTR(format,2)
status 19 /* full filename */
fullname=RESULT
/* We need an absolute name */
PARSE VALUE namestruc(fullname) WITH ivol idirs ibase .
IF "" == SUBSTR(fullname, 1+ivol+idirs+ibase) | UPPER(RIGHT(fullname,3)) ~= "TEX" THEN DO
okay1 "Sorry, filename must have an extension and end in `tex'."
EXIT 5
END
IF 0 = ivol THEN DO
direc = PRAGMA('d')
IF RIGHT(direc,1)~='/' & RIGHT(direc,1)~=':' THEN direc=direc||'/'
fullname = direc||fullname
DROP direc
END
DROP ivol idirs ibase
/* Save only if file has been modified */
status 18 /* number of changes to the file */
If 0 < RESULT THEN Save
IF (SHOW('P', portname)) THEN DO
/* set the default format, modify it to suit your needs */
envformat = mygetenv("TEXFORMAT")
IF "" == format THEN DO
format = envformat
IF askformat | "" = envformat THEN DO
IF "" = format THEN format = 'plain'
'GetString 'format '"Which format to use ?"'
nformat=RESULT
/* "RESULT" if cancelled */
IF "RESULT" ~= nformat THEN format = nformat
END /* askformat */
END /* format */
/* If the server is already busy with some compilation, this will
wait till compilation finishes, this may take a long time */
/* no unlocking (like in MG) available */
if format ~= envformat THEN CALL mysetenv("TEXFORMAT",format)
ADDRESS VALUE portname
'compile' format fullname
END
ELSE DO
/* The TeX server must be started first */
Okay1 'The TeX server 'script' is not running !'
EXIT 5
END
EXIT
mygetenv: procedure /* when will ARexx supply GetEnv/SetEnv ? */
PARSE ARG name
IF open(TEMPFILE,"ENV:"||name,'r') THEN DO
gives = readln(TEMPFILE)
CALL close TEMPFILE
END
ELSE gives = ""
RETURN gives
mysetenv: procedure
PARSE ARG name,content
ADDRESS COMMAND "SetEnv" name content
RETURN